Update Document
Introduction
There are 3 API's that are available for managing the metadata and links of a document:
- PUT /api/v2/document/{id}
- Updates document metadata
- PUT /api/v2/document/{id}/link
- Links the document to a parent record such as an asset or work request
- PUT /api/v2/document/{id}/keyphoto
- Sets the document to be the key photo (if it is linked to an asset)
These APIs require the GUID of the document to be known, represented as {id} in the above requests
Metadata Update
The following metadata properties may be modified via the API PUT /api/v2/document/{id}:
Property | Description | Type |
ExpiryDate | Date the document expires | Datetime |
DocumentGroup | High level classification of file content/relevance. Obtain options via API endpoint GET /api/v2/document/group | Integer |
DocumentCategory | Site specific categorisation of file content/relevance. Obtain options via API endpoint GET /api/v2/document/category | Integer |
DocumentSubCategory | Site specific subcategorisation of file content/relevance. Obtain options via API endpoint GET /api/v2/document/category/{id}/subcategory where {id} is the DocCategoryId | Integer |
DocumentLink | A URL. Must be preceded with the protocol such as HTTP, HTTPS, MAILTO etc. Required if FileProperty is null | String |
Label | A reference label for the DocumentLink. Required if DocumentLink is specific, but not required if FileProperty is specified | String |
Description | A free text field describing the document content | String(256) |
ExternalId | A reference to an external identifier | String(200) |
The "LastModified" property of the document record is updated to reflect the datetime that the document metadata was updated.
Sample Payloads
The following sample payload updates the metadata properties of a document:
https://XXX.assetic.net/api/v2/document/6dcd19e0-44d6-40ff-b5ac-f6f475115f32
{
"Id": "6dcd19e0-44d6-40ff-b5ac-f6f475115f32",
"Label": "Construction schema",
"ExternalId": "Doc 123",
"Description": "Outlines the construction of the asset",
"ExpiryDate": "2022-01-04T20:01:47",
"DocumentGroup": 1,
"DocumentSubCategory": 10005,
"DocumentCategory": 2
}
The following sample PUT request and payload updates the metadata properties of a document link:
https://XXX.assetic.net/api/v2/document/aebc9d46-5038-4355-851e-5cb1fe25d82c
{
"Id": "aebc9d46-5038-4355-851e-5cb1fe25d82c",
"Label": "link label updated",
"ExternalId": "Doc 124",
"Description": "Link to AAA Construction website",
"ExpiryDate": "2022-01-04T20:01:47",
"DocumentLink": "https://www.aaaconstruction.com",
"DocumentGroup": 1,
"DocumentSubCategory": 10005,
"DocumentCategory": 2
}
Document Link
The following properties are used in the payload that links a document to a parent record.
Property | Description | Type |
ParentType |
Optional. Required if linking the document to an Assetic record (in combination with ParentIdentifier or ParentId parameter) One of: 'None', 'All', 'ComplexAsset', 'WorkRequest', 'L2Assessment', 'DataExchange', 'GroupAssets'(functional location), 'Reports', 'WorkOrder', 'JobPlan', 'SearchProfle', 'FinancialYearAccountingReports', 'FinancialPeriodAccountingReports', 'AsmtProject', 'AsmtTask', 'AsmtFormResult', 'WorkOrder2', 'ValuationReport', 'RevaluationReport', 'BulkProcess', 'DataExchangeProfile', 'BackgroundWorkerLog', 'TransactionBatchExportJournals', 'FinancialYearFairValueJournalReport', 'FinancialPeriodFairValueJournalReport', 'FinancialYearHistoricalJournalReport', 'FinancialPeriodHistoriucalJournalReport', 'ReconciliationHistoricalReport', 'ReconciliationFairvalueReport', 'ServiceBusWorkerErrorDocument', 'BasicReconciliationHistoricalReport', 'BasicReconciliationFairvalueReport', 'Predictor', 'JobPlan2' |
String |
ParentId | The unique identifier of an Assetic record (i.e. asset, work order, assessment) to link the file to. Not required if "ParentIdentifier" is set. |
GUID |
ParentIdentifier | The user friendly ID of the Assetic record (e.g Asset ID, Work Order ID). Not required if "ParentId" is set. |
String |
The "LastModified" property of the document record is updated to reflect the datetime that the document was associated with the parent record.
Sample Payloads
The following PUT request and payload associates the document with GUID "a4813384-3062-471f-8f69-1d365723c9f7" to the asset with Asset Id "FEN691033":
https://XXX.assetic.net/api/v2/document/a4813384-3062-471f-8f69-1d365723c9f7/link
{
"ParentIdentifier": "FEN691033",
"ParentType": "ComplexAsset"
}
The following PUT request and payload associates the document with GUID "32f266b0-dcf1-4691-b453-ff8620c41f83" to the Work Request with GUID "790bdf1b-ae0e-450b-be80-3f24b51a2590":
https://XXX.assetic.net/api/v2/document/32f266b0-dcf1-4691-b453-ff8620c41f83/link
{
"ParentId": "790bdf1b-ae0e-450b-be80-3f24b51a2590",
"ParentType": "WorkRequest"
}
Set Key Photo
If the document is an image file and is associated with an asset then it can be set as the asset key photo. This means the Assetic UI will show that photo in the dashboard page of the asset.
Sample Payload
The following PUT request sets the document with GUID "6dcd19e0-44d6-40ff-b5ac-f6f475115f3" as the key photo for the asset the document is associated with.
https://xxx.assetic.net/api/v2/document/6dcd19e0-44d6-40ff-b5ac-f6f475115f32/keyphoto